package org.jeecg.modules.operations.assistant.oa.service.impl;

import org.jeecg.modules.operations.assistant.oa.entity.OaEmployeeInfo;
import org.jeecg.modules.operations.assistant.oa.entity.OaOvertimeRecord;
import org.jeecg.modules.operations.assistant.oa.entity.OaAttendanceRecord;
import org.jeecg.modules.operations.assistant.oa.entity.OaMonthlyAttendance;
import org.jeecg.modules.operations.assistant.oa.entity.OaMonthlyOvertime;
import org.jeecg.modules.operations.assistant.oa.entity.OaPaidWages;
import org.jeecg.modules.operations.assistant.oa.mapper.OaOvertimeRecordMapper;
import org.jeecg.modules.operations.assistant.oa.mapper.OaAttendanceRecordMapper;
import org.jeecg.modules.operations.assistant.oa.mapper.OaMonthlyAttendanceMapper;
import org.jeecg.modules.operations.assistant.oa.mapper.OaMonthlyOvertimeMapper;
import org.jeecg.modules.operations.assistant.oa.mapper.OaPaidWagesMapper;
import org.jeecg.modules.operations.assistant.oa.mapper.OaEmployeeInfoMapper;
import org.jeecg.modules.operations.assistant.oa.service.IOaEmployeeInfoService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
import java.util.List;
import java.util.Collection;

/**
 * @Description: 员工信息
 * @Author: jeecg-boot
 * @Date:   2024-12-12
 * @Version: V1.0
 */
@Service
public class OaEmployeeInfoServiceImpl extends ServiceImpl<OaEmployeeInfoMapper, OaEmployeeInfo> implements IOaEmployeeInfoService {

	@Autowired
	private OaEmployeeInfoMapper oaEmployeeInfoMapper;
	@Autowired
	private OaOvertimeRecordMapper oaOvertimeRecordMapper;
	@Autowired
	private OaAttendanceRecordMapper oaAttendanceRecordMapper;
	@Autowired
	private OaMonthlyAttendanceMapper oaMonthlyAttendanceMapper;
	@Autowired
	private OaMonthlyOvertimeMapper oaMonthlyOvertimeMapper;
	@Autowired
	private OaPaidWagesMapper oaPaidWagesMapper;
	
	@Override
	@Transactional(rollbackFor = Exception.class)
	public void delMain(String id) {
		oaOvertimeRecordMapper.deleteByMainId(id);
		oaAttendanceRecordMapper.deleteByMainId(id);
		oaMonthlyAttendanceMapper.deleteByMainId(id);
		oaMonthlyOvertimeMapper.deleteByMainId(id);
		oaPaidWagesMapper.deleteByMainId(id);
		oaEmployeeInfoMapper.deleteById(id);
	}

	@Override
	@Transactional(rollbackFor = Exception.class)
	public void delBatchMain(Collection<? extends Serializable> idList) {
		for(Serializable id:idList) {
			oaOvertimeRecordMapper.deleteByMainId(id.toString());
			oaAttendanceRecordMapper.deleteByMainId(id.toString());
			oaMonthlyAttendanceMapper.deleteByMainId(id.toString());
			oaMonthlyOvertimeMapper.deleteByMainId(id.toString());
			oaPaidWagesMapper.deleteByMainId(id.toString());
			oaEmployeeInfoMapper.deleteById(id);
		}
	}
	
}
